package evaluate;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

import common_var.Path;

public class Lisa_Que_Rel {
	public int querynumber = 0;
	public ArrayList<String> query = new ArrayList<String>();
	public ArrayList<ArrayList<Integer>> que_rels = new ArrayList<ArrayList<Integer>>();

	@SuppressWarnings("unused")
	public Lisa_Que_Rel() throws IOException {
		// TODO Auto-generated constructor stub
		// relavance
		Scanner sc = new Scanner(new File(Path.current_relfile));
		int queryid = -1;
		int number = -1;
		while (sc.hasNextInt()) {
			queryid = sc.nextInt();
			number = sc.nextInt();
			ArrayList<Integer> al = new ArrayList<Integer>();
			while (number-- != 0) {
				al.add(sc.nextInt());
			}
			que_rels.add(al);
		}
		// query
		BufferedReader br = new BufferedReader(new FileReader(Path.current_queryfile));
		int docid  =-1;
		String s = "";
		while((s = br.readLine())!=null)
		{
			docid = Integer.parseInt(s.trim());
			String querystring = "";
			while(!(s = br.readLine()).trim().endsWith("#"))
			{
				querystring+=s;
			}
			querystring+=s;
			this.query.add(querystring);
		}
		br.close();
		//
		this.querynumber = this.query.size();
	}

	public ArrayList<Integer> GetRels(int id) {
		return que_rels.get(id);
	}

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Path.Init(0);
		@SuppressWarnings("unused")
		Lisa_Que_Rel r = new Lisa_Que_Rel();
	}

}
